package classes
{
	public class AppUsers
	{
		private static const TABLE:String = "appusers";
		
		public static function Add(userid:String,password:String,name:String,gender:String,dob:String,city:String,country:String):void{
			try{
				var insertObj:Object = new Object();
				insertObj.userid = userid;
				insertObj.password = password;
				insertObj.gender = gender;
				insertObj.name = name;
				insertObj.dob = dob;
				insertObj.city = city;
				insertObj.country = country;
				DatabaseManager.Manager.Insert(TABLE,insertObj);
			}catch(err:Error){
				throw err;
			}
		}

		public static function Update(userid:String,password:String,name:String,gender:String,dob:String,city:String,country:String):void{
			try{
				var updateObj:Object = new Object();
				updateObj.password = password;
				updateObj.gender = gender;
				updateObj.name = name;
				updateObj.dob = dob;
				updateObj.city = city;
				updateObj.country = country;
				DatabaseManager.Manager.Update(TABLE,updateObj,"userid LIKE '"+userid+"'");
			}catch(err:Error){
				throw err;
			}
		}

		public static function List(condition:String = ""):Array{
			try{
				return DatabaseManager.Manager.Select(TABLE,null,condition,"userid");
			}catch(err:Error){
				throw err;
			}
			return new Array;
		}
		
		public static function Delete(condition:String = ""):void{
			try{
				DatabaseManager.Manager.Delete(TABLE,condition);
			}catch(err:Error){
				throw err;
			}
		}
	}
}